<%= simple_form_for @form, html: { class: 'editor' } do |f| %>
  <div id="descriptions_display">
    <h2 class="non lower"><%= t('sufia.collection.edit.description') %></h2>
    <div id="base-terms">
      <% f.object.primary_terms.each do |term| %>
        <%= render_edit_field_partial(term, f: f) %>
      <% end %>
    </div>
    <%= link_to t('sufia.collection.edit.additional_fields'),
            '#extended-terms',
            class: 'btn btn-default additional-fields',
            data: { toggle: 'collapse' },
            role: "button",
            'aria-expanded'=> "false",
            'aria-controls'=> "extended-terms" %>
    <div id="extended-terms" class='collapse'>
      <% f.object.secondary_terms.each do |term| %>
        <%= render_edit_field_partial(term, f: f) %>
      <% end %>
    </div>
  </div>
  <%= hidden_field_tag :type, params[:type] %>
  <% if params[:batch_document_ids].present? %>
    <% params[:batch_document_ids].each do |batch_item| %>
      <input type="hidden" name="batch_document_ids[]" value="<%= batch_item %>"/>
    <% end %>
  <% end %>

  <div class="collection_form_visibility">
    <%= render 'form_permission', f: f %>
  </div>

  <div class="primary-actions">
    <% if params[:action] == "new" %>
      <%= f.submit 'Create Collection', class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "create_submit", name: "create_collection" %>
    <% else %>
      <%= f.submit 'Update Collection', class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "update_submit", name: "update_collection" %>
    <% end %>
    <%= link_to t(:'helpers.action.cancel'), main_app.root_path, class: 'btn btn-link' %>
  </div>
<% end %>
